//
//  NSMutableArray+QTZ.m
//  QTZ
//
//  Created by ski on 2017/7/5.
//  Copyright © 2017年 ski. All rights reserved.
//

#import "NSMutableArray+QTZ.h"

@implementation NSMutableArray (QTZ)

- (void)addSafeObject:(id)anObject {
    if (anObject) {
        [self addObject:anObject];
    }
}

- (void)insertSafeObject:(id)anObject atIndex:(NSUInteger)index {
    if (anObject) {
        [self insertObject:anObject atIndex:index];
    }
}

- (id)objectAtSafeIndex:(NSUInteger)index
{
    if (self.count > index) {
        
        return [self objectAtIndex:index];
    }
    else{
        
        return nil;
    }
}

- (void)addObjectsFromSafeArray:(NSArray *)otherArray
{
    if (otherArray && otherArray.count > 0) {
        
        [self addObjectsFromArray:otherArray];
    }
}

@end
